<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home-page></home-page>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp();
    const CommonTitle = {
      template: `
        <div>
          <header>子组件头部</header>  
          <slot :a="a" :b="b" :c="c" title="静态的值"></slot>
          <footer>子组件尾部</footer>
        </div>
      `,
      data() {
        return {
          a: [1,2,3,4],
          b: 20,
          c: 30
        }
      },
    }
    const HomePage = {
      template: `
        <div>
          <h1>首页</h1>  
          <common-title v-slot="{a, b, title}">
            {{a}}
            <hr/>
            {{b}}
            {{title}}
          </common-title>
        </div>
      `,
      components: {
        CommonTitle
      }
    }

    app.component('HomePage', HomePage)
    app.mount('#app')
  </script>
</body>
</html>